#include "Menu.h"

Menu::Menu(MenuElementList * menuElements, Vector2D position, int index)
{
	this->menuElements = menuElements;
	this->position = position;
	this->index = index;
	isVisible = true;
}

Menu::~Menu()
{
	if(menuElements)
		delete(menuElements);
	menuElements = NULL;
}
int Menu::GetIndex()
{
	return index;
}
bool Menu::HandleUserInput(unsigned char key, int modifier, bool isDepressed)
{
	if(!isVisible || !menuElements)
		return false;
	return menuElements->HandleUserInput(key,modifier,isDepressed);
}
int Menu::Click(Vector2D mousePosition)
{
	if(!isVisible || !menuElements)
		return -1;
		
	return menuElements->Click( position, mousePosition);
}
void Menu::Hide()
{
	isVisible = false;
}
void Menu::Show()
{
	isVisible = true;
}
void Menu::Draw()
{
	if(isVisible && menuElements)
	{
		menuElements->Draw(position);
	}
}
